uniform sampler2D image;  
uniform vec2 screenSize;


  
void main(void) { 
  
  float depth, minDepth=1.0; 
  float depthv= 0.0, depthh= 0.0;
  vec3 result;	
  int i; 

  float alpha= texture2D(image, gl_FragCoord.xy/screenSize).a;

  vec2 offsets[9];
  
 offsets[0]=  vec2(-1.0, -1.0);
  offsets[1]=  vec2( 0.0, -1.0);
  offsets[2]=  vec2( 1.0, -1.0);
  offsets[3]=  vec2(-1.0,  0.0);
  offsets[4]=  vec2( 0.0,  0.0);
  offsets[5]=  vec2( 1.0,  0.0);
  offsets[6]=  vec2(-1.0,  1.0);
  offsets[7]=  vec2( 0.0,  1.0);
  offsets[8]=  vec2( 1.0,  1.0); 


  // Sobel of Gaussian filter kernels

  float gaussian[9];
  
  gaussian[0]=  1.0;
  gaussian[1]=  2.0;
  gaussian[2]=  1.0;
  gaussian[3]=  2.0;
  gaussian[4]=  4.0;
  gaussian[5]=  2.0;
  gaussian[6]=  1.0;
  gaussian[7]=  2.0;
  gaussian[8]=  1.0; 


  for(i=0; i<9; i++){
    result+= gaussian[i]*texture2D(image, (gl_FragCoord.xy+offsets[i])/screenSize).rgb;

  } 

  if(alpha!=0.0){
    gl_FragColor= vec4(result/16.0, alpha);
  }
  else discard;

  //gl_FragColor= vec4(texture2D(depthTexture, (gl_FragCoord.xy)/screenSize).xyz, 1.0);
}